3D Graphics Programming with QuickDraw 3D 1.5.4
Previous | QD3D Book | Overview | Chapter Contents | Next |
Every object in QuickDraw 3D contains object methods, which generally deal with name space information, allocation and deallocation, I/O processes, and submit routines. The TQ3MethodType type is declared as follows:
typedef unsigned long TQ3MethodType;
The public methods are the following:
kQ3MethodTypeObjectClassVersion kQ3MethodTypeObjectClassRegister kQ3MethodTypeObjectClassReplace kQ3MethodTypeObjectClassUnregister kQ3MethodTypeObjectNew kQ3MethodTypeObjectDelete kQ3MethodTypeObjectCopy kQ3MethodTypeObjectTraverseData
A method which applies to every level in a hierarchy is called a multilevel method. Generally, only object methods are multilevel, though other aspects of QuickDraw 3D may use multilevel methods, if desired.
Many object methods apply to the private class structure or the private instance structure of a particular class. When an object class or object instance is created, a data structure for each level is allocated and initialized by each class. Creation occurs from root to leaf. If a failure occurs midway through creation, only those levels which were initialized are deleted.
The multi-level methods used in QuickDraw 3D are
kQ3MethodTypeObjectClassRegister kQ3MethodTypeObjectClassReplace kQ3MethodTypeObjectClassUnregister kQ3MethodTypeObjectNew kQ3MethodTypeObjectDelete kQ3MethodTypeObjectDuplicate kQ3MethodTypeObjectTraverseData
These methods should never be returned in a virtual metahandler, because they always apply to a single level in a particular object class.
Figure 8 illustrates how the multilevel methods _New and _Delete can be used to create the bar object hierarchy.
Figure 8 Object creation using multilevel methods
Previous | QD3D Book | Overview | Chapter Contents | Next |